#ifndef EFFECT_H
#define EFFECT_H

#include "common.h"

//------------------------------------------------------------
// EFFECT DATA (packed into 32bits) 
// = dddd dddd dddd dddd dddd ddIL ffff ffff
//------------------------------------------------------------
// d = direction (arithmetic left-shifted)
// I = indirect effect flag
// L = long effect flag
// f = position of the piece which makes the effect
//------------------------------------------------------------

const int EF_LONG = 0x100;
const int EF_INDR = 0x200;

#define EFFECT(from,d,flg) ((d)<<10|(flg)|(from))

#define EF_DIR(e)     (p2i(e)>>10)
#define EF_FROM(e)    (p2i(e)&0xFF)

#define EF_IS_LONG(e) (p2i(e)&EF_LONG)
#define EF_IS_INDR(e) (p2i(e)&EF_INDR)

struct effect_t {
  int num,data[31];
};

#endif // EFFECT_H